<template>
    <van-skeleton title :row="3" />

    <div>
        <van-form @submit="onSubmit">
            <van-cell-group inset>
                <van-field v-model="userInfo.username" name="username" label="+86" placeholder="用户名"
                    :rules="[{ required: true, message: '请填写用户名' }]" />
                <van-field v-model="userInfo.password" type="password" name="password" label="密码" placeholder="密码"
                    :rules="[{ required: true, message: '请填写密码' }]" />
            </van-cell-group>
            <div style="margin: 16px;">
                <van-button round block type="primary" native-type="submit">
                    登录
                </van-button>
            </div>
        </van-form>
        <van-checkbox name="a">我同意遵守</van-checkbox>
    </div>
</template>

<script setup>
import { useRouter } from 'vue-router';
import { useloginStore } from '../store';
import { storeToRefs } from 'pinia';
let router = new useRouter()
const { userInfo } = storeToRefs(useloginStore())
const onSubmit = ({ username, password }) => {
    if (username == '15835890510' && password == '123456') {
        localStorage.setItem('token', 'dfgfdghf')
        router.push('/home')
    }
};

</script>

<style lang="scss" scoped></style>